<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>v_hdmirxss: si5324drv.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">v_hdmirxss
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('si5324drv_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">si5324drv.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains low-level driver functions for controlling the SiliconLabs Si5324 clock generator as mounted on the KC705 demo board. </p>
<p>The user should refer to the hardware device specification for more details of the device operation.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who Date         Changes
<hr/>

1.00  hf  2014/10/10   First release
1.10  MG  2016/07/05   Updated LOCKT register
1.11  YH  2016/09/14   Add option to enable fast switching
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a646751e6239e3401140c8c2a61c760a6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a646751e6239e3401140c8c2a61c760a6">Si5324_DoSettings</a> (u32 IICBaseAddress, u8 IICAddress, u8 *BufPtr, int NumRegs)</td></tr>
<tr class="memdesc:a646751e6239e3401140c8c2a61c760a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a list of register settings to the Si5324 clock generator.  <a href="#a646751e6239e3401140c8c2a61c760a6">More...</a><br /></td></tr>
<tr class="separator:a646751e6239e3401140c8c2a61c760a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9e636114c299d13030d4959417c70e6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#af9e636114c299d13030d4959417c70e6">Si5324_Reset</a> (u32 IICBaseAddress, u8 IICAddress)</td></tr>
<tr class="memdesc:af9e636114c299d13030d4959417c70e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset the SiliconLabs Si5324 clock generator.  <a href="#af9e636114c299d13030d4959417c70e6">More...</a><br /></td></tr>
<tr class="separator:af9e636114c299d13030d4959417c70e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a185d22bffe298f0a1a702769d154e5a1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a185d22bffe298f0a1a702769d154e5a1">Si5324_Init</a> (u32 IICBaseAddress, u8 IICAddress)</td></tr>
<tr class="memdesc:a185d22bffe298f0a1a702769d154e5a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the SiliconLabs Si5324 clock generator.  <a href="#a185d22bffe298f0a1a702769d154e5a1">More...</a><br /></td></tr>
<tr class="separator:a185d22bffe298f0a1a702769d154e5a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03e66fb25677d88c111b603b18301662"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a03e66fb25677d88c111b603b18301662">Si5324_RatApprox</a> (u64 f, u64 md, u32 *num, u32 *denom)</td></tr>
<tr class="memdesc:a03e66fb25677d88c111b603b18301662"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find the closest rational approximation for the N2_LS/N3 fraction.  <a href="#a03e66fb25677d88c111b603b18301662">More...</a><br /></td></tr>
<tr class="separator:a03e66fb25677d88c111b603b18301662"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a372fa6209b36e5fdb84df6141eed682f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a372fa6209b36e5fdb84df6141eed682f">Si5324_FindN2ls</a> (si5324_settings_t *settings)</td></tr>
<tr class="memdesc:a372fa6209b36e5fdb84df6141eed682f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Search through the possible settings for the N2_LS parameter.  <a href="#a372fa6209b36e5fdb84df6141eed682f">More...</a><br /></td></tr>
<tr class="separator:a372fa6209b36e5fdb84df6141eed682f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80fcbb47ed73a63de3c6ce58d7cd2398"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a80fcbb47ed73a63de3c6ce58d7cd2398">Si5324_FindN2</a> (si5324_settings_t *settings)</td></tr>
<tr class="memdesc:a80fcbb47ed73a63de3c6ce58d7cd2398"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find a valid setting for N2_HS and N2_LS.  <a href="#a80fcbb47ed73a63de3c6ce58d7cd2398">More...</a><br /></td></tr>
<tr class="separator:a80fcbb47ed73a63de3c6ce58d7cd2398"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a756bafb27288aa8cf3100c14800d9a4e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a756bafb27288aa8cf3100c14800d9a4e">Si5324_CalcNclsLimits</a> (si5324_settings_t *settings)</td></tr>
<tr class="memdesc:a756bafb27288aa8cf3100c14800d9a4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the valid range for NCn_LS with the value for the output frequency and N1_HS already set in settings.  <a href="#a756bafb27288aa8cf3100c14800d9a4e">More...</a><br /></td></tr>
<tr class="separator:a756bafb27288aa8cf3100c14800d9a4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a821e65d96eee95550e5c2b2b393b0ee1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a821e65d96eee95550e5c2b2b393b0ee1">Si5324_FindNcls</a> (si5324_settings_t *settings)</td></tr>
<tr class="memdesc:a821e65d96eee95550e5c2b2b393b0ee1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find a valid setting for NCn_LS that can deliver the correct output frequency.  <a href="#a821e65d96eee95550e5c2b2b393b0ee1">More...</a><br /></td></tr>
<tr class="separator:a821e65d96eee95550e5c2b2b393b0ee1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d9c096a3379e1a3e168b33f7d0c27f2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a9d9c096a3379e1a3e168b33f7d0c27f2">Si5324_CalcFreqSettings</a> (u32 ClkInFreq, u32 ClkOutFreq, u8 *N1_hs, u32 *NCn_ls, u8 *N2_hs, u32 *N2_ls, u32 *N3n, u8 *BwSel)</td></tr>
<tr class="memdesc:a9d9c096a3379e1a3e168b33f7d0c27f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate the frequency settings for the desired output frequency.  <a href="#a9d9c096a3379e1a3e168b33f7d0c27f2">More...</a><br /></td></tr>
<tr class="separator:a9d9c096a3379e1a3e168b33f7d0c27f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5fe598dcb0d500c012afc7970117f5ed"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a5fe598dcb0d500c012afc7970117f5ed">Si5324_SetClock</a> (u32 IICBaseAddress, u8 IICAddress, u8 ClkSrc, u32 ClkInFreq, u32 ClkOutFreq)</td></tr>
<tr class="memdesc:a5fe598dcb0d500c012afc7970117f5ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the output frequency of the Si5324 clock generator.  <a href="#a5fe598dcb0d500c012afc7970117f5ed">More...</a><br /></td></tr>
<tr class="separator:a5fe598dcb0d500c012afc7970117f5ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a20b8835416e6bdb5d4c48e1ded4279c3"><td class="memItemLeft" align="right" valign="top">u8&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="si5324drv_8c.html#a20b8835416e6bdb5d4c48e1ded4279c3">SI5324_DEFAULTS</a> []</td></tr>
<tr class="memdesc:a20b8835416e6bdb5d4c48e1ded4279c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default register settings that differ from the (power-on-)reset values.  <a href="#a20b8835416e6bdb5d4c48e1ded4279c3">More...</a><br /></td></tr>
<tr class="separator:a20b8835416e6bdb5d4c48e1ded4279c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a9d9c096a3379e1a3e168b33f7d0c27f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9d9c096a3379e1a3e168b33f7d0c27f2">&#9670;&nbsp;</a></span>Si5324_CalcFreqSettings()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_CalcFreqSettings </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ClkInFreq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ClkOutFreq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>N1_hs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>NCn_ls</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>N2_hs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>N2_ls</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>N3n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>BwSel</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculate the frequency settings for the desired output frequency. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ClkInFreq</td><td>contains the frequency of the input clock. </td></tr>
    <tr><td class="paramname">ClkOutFreq</td><td>contains the desired output clock frequency. </td></tr>
    <tr><td class="paramname">N1_hs</td><td>will be set to the value for the N1_HS register. </td></tr>
    <tr><td class="paramname">NCn_ls</td><td>will be set to the value for the NCn_LS register. </td></tr>
    <tr><td class="paramname">N2_hs</td><td>will be set to the value for the N2_HS register. </td></tr>
    <tr><td class="paramname">N2_ls</td><td>will be set to the value for the N2_LS register. </td></tr>
    <tr><td class="paramname">N3n</td><td>will be set to the value for the N3n register. </td></tr>
    <tr><td class="paramname">BwSel</td><td>will be set to the value for the BW_SEL register.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>SI5324_SUCCESS for success, SI5324_ERR_FREQ when the requested frequency cannot be generated. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#a228ebaa351cbbfc0f6c5c94554d7ca4e">SI5324_F3_MAX</a>, <a class="el" href="si5324drv_8h.html#a0883e98bf3d4a3ce4e051b598212fe1e">SI5324_FOSC_MAX</a>, <a class="el" href="si5324drv_8h.html#a8adf10a1b80feb2992f6b971cdd28271">SI5324_FOSC_MIN</a>, <a class="el" href="si5324drv_8h.html#aca2c63c7a287455eff6d20da1772484e">SI5324_N1_HS_MAX</a>, <a class="el" href="si5324drv_8h.html#a3d32f6e4587dbcf01bc3a2c2e91a2df7">SI5324_N1_HS_MIN</a>, <a class="el" href="si5324drv_8h.html#af66f4eb0a55fc7655b5d6ce991660dc8">SI5324_N3_MIN</a>, <a class="el" href="si5324drv_8h.html#a1970bf7864d31f729e163d103a903075">SI5324_NC_LS_MAX</a>, and <a class="el" href="si5324drv_8h.html#a69fe20269cf003fdcf22f5fc1cd2769c">SI5324_NC_LS_MIN</a>.</p>

<p class="reference">Referenced by <a class="el" href="si5324drv_8h.html#a5fe598dcb0d500c012afc7970117f5ed">Si5324_SetClock()</a>.</p>

</div>
</div>
<a id="a756bafb27288aa8cf3100c14800d9a4e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a756bafb27288aa8cf3100c14800d9a4e">&#9670;&nbsp;</a></span>Si5324_CalcNclsLimits()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_CalcNclsLimits </td>
          <td>(</td>
          <td class="paramtype">si5324_settings_t *&#160;</td>
          <td class="paramname"><em>settings</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the valid range for NCn_LS with the value for the output frequency and N1_HS already set in settings. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">settings</td><td>Holds the input and output frequencies and the setting for N1_HS. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-1 when there are no valid settings for NCn_LS, 0 otherwise. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#a1970bf7864d31f729e163d103a903075">SI5324_NC_LS_MAX</a>, and <a class="el" href="si5324drv_8h.html#a69fe20269cf003fdcf22f5fc1cd2769c">SI5324_NC_LS_MIN</a>.</p>

</div>
</div>
<a id="a646751e6239e3401140c8c2a61c760a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a646751e6239e3401140c8c2a61c760a6">&#9670;&nbsp;</a></span>Si5324_DoSettings()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_DoSettings </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>IICBaseAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>IICAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>BufPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>NumRegs</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a list of register settings to the Si5324 clock generator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IICBaseAddress</td><td>contains the base address of the IIC master device. </td></tr>
    <tr><td class="paramname">IICAddress</td><td>contains the 7 bit IIC address of the Si5324 device. </td></tr>
    <tr><td class="paramname">BufPtr</td><td>is a pointer to an array with alternating register addresses and register values to program into the Si5324. The array length must be at least 2*NumRegs. </td></tr>
    <tr><td class="paramname">NumRegs</td><td>contains the number of registers to write.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>SI5324_SUCCESS for success, SI5324_ERR_IIC for IIC access failure, SI5324_ERR_PARM when the number of registers to write is less than one.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. Does not modify the contents of the buffer pointed to by BufPtr. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, <a class="el" href="si5324drv_8h.html#a9ede2c0617ef9093ee69e3c5a01199f8">SI5324_ERR_IIC</a>, <a class="el" href="si5324drv_8h.html#a5fa75e494c0f242ce3a8d43680ec5b25">SI5324_ERR_PARM</a>, and <a class="el" href="si5324drv_8h.html#ab111a2a2d52eb8e3366d8c5723a186a8">SI5324_SUCCESS</a>.</p>

<p class="reference">Referenced by <a class="el" href="si5324drv_8h.html#a185d22bffe298f0a1a702769d154e5a1">Si5324_Init()</a>, <a class="el" href="si5324drv_8c.html#af9e636114c299d13030d4959417c70e6">Si5324_Reset()</a>, and <a class="el" href="si5324drv_8h.html#a5fe598dcb0d500c012afc7970117f5ed">Si5324_SetClock()</a>.</p>

</div>
</div>
<a id="a80fcbb47ed73a63de3c6ce58d7cd2398"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a80fcbb47ed73a63de3c6ce58d7cd2398">&#9670;&nbsp;</a></span>Si5324_FindN2()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_FindN2 </td>
          <td>(</td>
          <td class="paramtype">si5324_settings_t *&#160;</td>
          <td class="paramname"><em>settings</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Find a valid setting for N2_HS and N2_LS. </p>
<p>Finds the best setting for N2_HS, N2_LS, and N3n with the values for N1_HS, and NCn_LS already set in settings. Iterates over all possibilities of N2_HS and then performs a binary search over the N2_LS values.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">settings</td><td>Holds the settings up till now. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 when the best possible result has been found. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, <a class="el" href="si5324drv_8h.html#a228ebaa351cbbfc0f6c5c94554d7ca4e">SI5324_F3_MAX</a>, <a class="el" href="si5324drv_8h.html#a8c09138972a1acb59eb46de878c97a3a">SI5324_N2_HS_MAX</a>, <a class="el" href="si5324drv_8h.html#a33d91ebd8ce05be9f823fc82e35a5d38">SI5324_N2_HS_MIN</a>, and <a class="el" href="si5324drv_8h.html#a59663975c6b419aae6b34f3ef265605e">SI5324_N2_LS_MIN</a>.</p>

<p class="reference">Referenced by <a class="el" href="si5324drv_8c.html#a821e65d96eee95550e5c2b2b393b0ee1">Si5324_FindNcls()</a>.</p>

</div>
</div>
<a id="a372fa6209b36e5fdb84df6141eed682f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a372fa6209b36e5fdb84df6141eed682f">&#9670;&nbsp;</a></span>Si5324_FindN2ls()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_FindN2ls </td>
          <td>(</td>
          <td class="paramtype">si5324_settings_t *&#160;</td>
          <td class="paramname"><em>settings</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Search through the possible settings for the N2_LS parameter. </p>
<p>Finds the best setting for N2_LS and N3n with the values for N1_HS, NCn_LS, and N2_HS already set in settings.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">settings</td><td>Holds the settings up till now. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 when the best possible result has been found. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, and <a class="el" href="si5324drv_8c.html#a03e66fb25677d88c111b603b18301662">Si5324_RatApprox()</a>.</p>

</div>
</div>
<a id="a821e65d96eee95550e5c2b2b393b0ee1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a821e65d96eee95550e5c2b2b393b0ee1">&#9670;&nbsp;</a></span>Si5324_FindNcls()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_FindNcls </td>
          <td>(</td>
          <td class="paramtype">si5324_settings_t *&#160;</td>
          <td class="paramname"><em>settings</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Find a valid setting for NCn_LS that can deliver the correct output frequency. </p>
<p>Assumes that the valid range is relatively small so a full search can be done (should be true for video clock frequencies).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">settings</td><td>Holds the input and output frequencies, the setting for N1_HS, and the limits for NCn_LS. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 when the best possible result has been found. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, and <a class="el" href="si5324drv_8c.html#a80fcbb47ed73a63de3c6ce58d7cd2398">Si5324_FindN2()</a>.</p>

</div>
</div>
<a id="a185d22bffe298f0a1a702769d154e5a1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a185d22bffe298f0a1a702769d154e5a1">&#9670;&nbsp;</a></span>Si5324_Init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_Init </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>IICBaseAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>IICAddress</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the SiliconLabs Si5324 clock generator. </p>
<p>After initialization, the clock generator is not generating a clock yet. Call si5324_set_clock to start the clock generator.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IICBaseAddress</td><td>contains the base address of the IIC master device. </td></tr>
    <tr><td class="paramname">IICAddress</td><td>contains the 7 bit IIC address of the Si5324 device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>SI5324_SUCCESS for success, SI5324_ERR_IIC for IIC access failure. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, <a class="el" href="si5324drv_8c.html#a20b8835416e6bdb5d4c48e1ded4279c3">SI5324_DEFAULTS</a>, and <a class="el" href="si5324drv_8c.html#a646751e6239e3401140c8c2a61c760a6">Si5324_DoSettings()</a>.</p>

</div>
</div>
<a id="a03e66fb25677d88c111b603b18301662"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a03e66fb25677d88c111b603b18301662">&#9670;&nbsp;</a></span>Si5324_RatApprox()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Si5324_RatApprox </td>
          <td>(</td>
          <td class="paramtype">u64&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u64&#160;</td>
          <td class="paramname"><em>md</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>denom</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Find the closest rational approximation for the N2_LS/N3 fraction. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>Holds the N2_LS/N3 fraction in 36.28 fixed point notation. </td></tr>
    <tr><td class="paramname">md</td><td>Holds the maximum denominator (N3) value allowed. </td></tr>
    <tr><td class="paramname">num</td><td>Will store the numinator (N2_LS) found. </td></tr>
    <tr><td class="paramname">denom</td><td>Will store the denominator (N3) found. </td></tr>
  </table>
  </dd>
</dl>

<p class="reference">Referenced by <a class="el" href="si5324drv_8c.html#a372fa6209b36e5fdb84df6141eed682f">Si5324_FindN2ls()</a>.</p>

</div>
</div>
<a id="af9e636114c299d13030d4959417c70e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af9e636114c299d13030d4959417c70e6">&#9670;&nbsp;</a></span>Si5324_Reset()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_Reset </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>IICBaseAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>IICAddress</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reset the SiliconLabs Si5324 clock generator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IICBaseAddress</td><td>contains the base address of the IIC master device. </td></tr>
    <tr><td class="paramname">IICAddress</td><td>contains the 7 bit IIC address of the Si5324 device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>SI5324_SUCCESS for success, SI5324_ERR_IIC for IIC access failure.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Private function. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, <a class="el" href="si5324drv_8c.html#a646751e6239e3401140c8c2a61c760a6">Si5324_DoSettings()</a>, <a class="el" href="si5324drv_8h.html#a9ede2c0617ef9093ee69e3c5a01199f8">SI5324_ERR_IIC</a>, and <a class="el" href="si5324drv_8h.html#ab111a2a2d52eb8e3366d8c5723a186a8">SI5324_SUCCESS</a>.</p>

</div>
</div>
<a id="a5fe598dcb0d500c012afc7970117f5ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5fe598dcb0d500c012afc7970117f5ed">&#9670;&nbsp;</a></span>Si5324_SetClock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Si5324_SetClock </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>IICBaseAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>IICAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>ClkSrc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ClkInFreq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>ClkOutFreq</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the output frequency of the Si5324 clock generator. </p>
<p>Set the output frequency.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IICBaseAddress</td><td>contains the base address of the IIC master device. </td></tr>
    <tr><td class="paramname">IICAddress</td><td>contains the 7 bit IIC address of the Si5324 device. </td></tr>
    <tr><td class="paramname">ClkSrc</td><td>selects the clock input to use. </td></tr>
    <tr><td class="paramname">ClkInFreq</td><td>contains the frequency of the input clock (2kHz-710MHz). </td></tr>
    <tr><td class="paramname">ClkOutFreq</td><td>contains the desired output clock frequency (2kHz-945MHz).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>SI5324_SUCCESS for success, SI5324_ERR_IIC for IIC access failure, SI5324_ERR_FREQ when the requested frequency cannot be generated, SI5324_ERR_PARM when the ClkSrc or ClkDest parameters are invalid or the ClkInFreq or ClkOutFreq are out of range. </dd></dl>

<p class="reference">References <a class="el" href="si5324drv_8c.html#a9d9c096a3379e1a3e168b33f7d0c27f2">Si5324_CalcFreqSettings()</a>, <a class="el" href="si5324drv_8h.html#a2db6980ae01d5ddad9a49d3251516feb">SI5324_CLKSRC_CLK1</a>, <a class="el" href="si5324drv_8h.html#a02493d2265012108f5e0d4b80b199c76">SI5324_CLKSRC_CLK2</a>, <a class="el" href="si5324drv_8h.html#aa1d51e9b1e4b660eee4ec41222751c1e">SI5324_CLKSRC_XTAL</a>, <a class="el" href="si5324drv_8h.html#aa7a50734f0226414ddcb1e1c30815f20">SI5324_DEBUG</a>, <a class="el" href="si5324drv_8c.html#a646751e6239e3401140c8c2a61c760a6">Si5324_DoSettings()</a>, <a class="el" href="si5324drv_8h.html#a5fa75e494c0f242ce3a8d43680ec5b25">SI5324_ERR_PARM</a>, <a class="el" href="si5324drv_8h.html#aa37b2b306f750c592c636849367b5987">SI5324_FIN_MAX</a>, <a class="el" href="si5324drv_8h.html#a81ac3490c0ed20fabfa1b71584eac04b">SI5324_FIN_MIN</a>, <a class="el" href="si5324drv_8h.html#ae6cb6ad9a6bdd28badfa7d4dbd404b89">SI5324_FOUT_MAX</a>, <a class="el" href="si5324drv_8h.html#ad6256033a0e61e3af40ff9d7cb420639">SI5324_FOUT_MIN</a>, and <a class="el" href="si5324drv_8h.html#ab111a2a2d52eb8e3366d8c5723a186a8">SI5324_SUCCESS</a>.</p>

<p class="reference">Referenced by <a class="el" href="xhdmi__example_8c.html#a13f636ef2d93d7ee10e421e5f604a510">I2cClk()</a>.</p>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a20b8835416e6bdb5d4c48e1ded4279c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a20b8835416e6bdb5d4c48e1ded4279c3">&#9670;&nbsp;</a></span>SI5324_DEFAULTS</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8 SI5324_DEFAULTS[]</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Default register settings that differ from the (power-on-)reset values. </p>
<p>This array consists of pairs with the first value the register number and the second number the register value. </p>

<p class="reference">Referenced by <a class="el" href="si5324drv_8h.html#a185d22bffe298f0a1a702769d154e5a1">Si5324_Init()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
